home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Libraries / PlayerPRO 4.5.8 / PlayerPRO 4.5.8 Dev.Kit / MADH Library 4.5 / Libraries & Headers / MAD.h next >
Encoding:
Text File  |  1997-07-10  |  5.1 KB  |  235 lines  |  [TEXT/CWIE]

  1. /********************                        ***********************/
  2. //
  3. //    Player PRO 4.5x -- MAD Music Driver Definition -
  4. //
  5. //    Library Version 4.5
  6. //
  7. //    To use with MAD Library for Mac Symantec, CodeWarrior and MPW
  8. //
  9. //    Antoine ROSSET
  10. //    16 Tranchees
  11. //    1206 GENEVA
  12. //    SWITZERLAND
  13. //
  14. //    Thank you for your interest in PlayerPRO !
  15. //
  16. //    FAX:        (+41 22) 346 11 97
  17. //    PHONE:         (+41 79) 203 74 62
  18. //    Internet:     rosset@dial.eunet.ch or RossetAntoine@bluewin.ch
  19. //
  20. /********************                        ***********************/
  21.  
  22. #ifndef __MADH__
  23. #define __MADH__
  24.  
  25. //////////////////////////////////////////////////////////////////////
  26. #if defined(THINK_C)            // MACINTOSH
  27. #define _MAC_H
  28. #define EXP
  29.  
  30. #elif macintosh                                    
  31.  
  32. #define _MAC_H
  33. #define EXP
  34.  
  35. //////////////////////////////////////////////////////////////////////
  36. #elif __dest_os == __be_os        // BEOS
  37.  
  38. #define _BE_H
  39. #define EXP
  40.  
  41. //////////////////////////////////////////////////////////////////////
  42. #elif defined (WIN32)                    // WIN32 - 95/NT
  43.  
  44. #define _INTEL_H
  45. #define EXP __declspec(dllexport)
  46.  
  47. #endif
  48. //////////////////////////////////////////////////////////////////////
  49.  
  50. #if defined(_INTEL_H) || defined (_BE_H)
  51.  
  52. #if !defined(THINK_C)
  53. #include "stdio.h"
  54. #include "stdlib.h"
  55. #include "string.h"
  56.  
  57. #define NewPtr(x)                    (Ptr) malloc(x)
  58. #define NewPtrClear(x)                  (Ptr) calloc(x, 1)
  59. #define NewPtrSys(x)                (Ptr) malloc(x)
  60. #define NewPtrSysClear(x)             (Ptr) calloc(x, 1)
  61.  
  62. #define DisposPtr(x)                free(x)
  63. #define DisposePtr(x)                free(x)
  64. #define BlockMoveData(x,y,z)        memcpy(y,x,z)
  65. #define BlockMove(x,y,z)            memcpy(y,x,z)
  66. #define MemError()                    0
  67. #define DebugStr(x)                    debugger( (char*) x)
  68.  
  69.  
  70. #ifndef true
  71. #define true     TRUE
  72. #endif
  73.  
  74. #ifndef false
  75. #define false    FALSE
  76. #endif
  77.  
  78. typedef unsigned char     Byte;
  79. typedef char             *Ptr;
  80. typedef Ptr             *Handle;
  81. typedef unsigned char     Boolean;
  82. typedef short             OSErr;
  83. typedef unsigned char     Str255[256], Str63[64];
  84. typedef unsigned long     OSType;
  85.  
  86. #define FSSpec    char
  87. #define noErr    0
  88. #endif
  89. #endif
  90.  
  91. //////////////////////////////////////////////////////////////////////
  92.  
  93. #if defined(powerc) || defined (__powerc)
  94. #pragma options align=mac68k
  95. #else
  96. #if !defined(THINK_C)
  97. #pragma options align=mac68k
  98. #endif
  99. #endif
  100.  
  101. #define DEFAULT_VOLFADE        300
  102.  
  103. // ***    
  104. // ***    PATTERN DESCRIPTION
  105. // ***    
  106.  
  107. struct Cmd                            // COMMAND
  108. {
  109.     Byte    ins;                        // Instrument no        0x00: no ins cmd
  110.     Byte     note;                    // Note, see table        0xFF : no note cmd
  111.     Byte     cmd;                    // Effect cmd
  112.     Byte     arg;                    // Effect argument
  113.     Byte    vol;                    // Volume                0xFF : no volume cmd
  114.     Byte    unused;
  115. };
  116. typedef struct Cmd Cmd;
  117.  
  118. struct PatHeader                    // HEADER
  119. {
  120.     long    size;                    // Length of pattern: standard = 64
  121.     long    compMode;                // Compression mode, none = 'NONE'
  122.     char    name[ 32];
  123.     long    patBytes;                // Pattern Size in Bytes
  124.     long    unused2;
  125. };
  126. typedef struct PatHeader PatHeader;
  127.  
  128. struct PatData                        // DATA STRUCTURE : HEADER + COMMANDS
  129. {                                    // Pattern = 64 notes to play
  130.     PatHeader    header;
  131.     Cmd            Cmds[];
  132. };
  133. typedef struct PatData PatData;
  134.  
  135.  
  136.  
  137. // ***    
  138. // ***    INSTRUMENT DESCRIPTION
  139. // ***    
  140.  
  141.  
  142. struct sData                                // SAMPLE
  143. {
  144.     long                 size;                // Sample length
  145.     long                loopBeg;            // LoopStart
  146.     long                loopSize;            // LoopLength
  147.     Byte                 vol;                // Base volume
  148.     unsigned short        c2spd;                // c2spd
  149.     Byte                loopType;
  150.     Byte                amp;                // 8 or 16 bits
  151.     Byte                panning;
  152.     char                relNote;
  153.     char                 name[ 32];            // Sample name
  154.     Ptr                    data;                // Used only in memory, not in files
  155. };
  156. typedef struct sData sData;
  157.  
  158. struct EnvRec                // Volume Enveloppe
  159. {
  160.     short     pos;                // pos
  161.     short    val;                // val
  162. };
  163. typedef struct EnvRec EnvRec;
  164.  
  165. struct InstrData                // INSTRUMENT
  166. {
  167.     char     name[ 32];            // instrument name
  168.     Byte     type;                // Instrument type = 0
  169.  
  170.     short    numSamples;        // Number of samples in instrument
  171.  
  172.     /**/
  173.  
  174.     Byte        what[ 96];        // Sample number for all notes
  175.     EnvRec         volEnv[ 12];    // Points for volume envelope
  176.     EnvRec        pannEnv[ 12];    // Points for panning envelope
  177.     
  178.     Byte    volSize;            // Number of volume points
  179.     Byte    pannSize;            // Number of panning points
  180.     
  181.     Byte    volSus;                // Volume sustain point
  182.     Byte    volBeg;                // Volume loop start point
  183.     Byte    volEnd;                // Volume loop end point
  184.     
  185.     Byte    pannSus;            // Panning sustain point
  186.     Byte    pannBeg;            // Panning loop start point
  187.     Byte    pannEnd;            // Panning loop end point
  188.  
  189.     Byte    volType;            // Volume type: bit 0: On; 1: Sustain; 2: Loop
  190.     Byte    pannType;            // Panning type: bit 0: On; 1: Sustain; 2: Loop
  191.     
  192.     unsigned short    volFade;    // Volume fadeout
  193.     
  194.     Byte    vibDepth;
  195.     Byte    vibRate;
  196. };
  197. typedef struct InstrData InstrData;
  198.  
  199.  
  200. enum
  201. {
  202.     EFON            = 1,
  203.     EFSUSTAIN    = 2,
  204.     EFLOOP        = 4
  205. };
  206.  
  207.  
  208. // ***    
  209. // ***    MAD FILE HEADER DESCRIPTION
  210. // ***    
  211.  
  212.  
  213. struct MADSpec
  214. {
  215.     long        MAD;                        // Mad Identification: MADG in version 2.0
  216.     char         name[ 32];                    // Music's name
  217.     char        infos[ 256];                // Informations & Author name of the music
  218.     Byte        numPat;                    // Patterns number
  219.     Byte        numChn;                    // Channels number
  220.     Byte         numPointers;                // Partition length
  221.     Byte        oPointers[ 256];            // Partition : Patterns ID List
  222.     short        speed;                        // Default speed
  223.     short        tempo;                        // Default tempo
  224.     InstrData     fid[ 64];                    // Instruments description
  225. };
  226. typedef struct MADSpec MADSpec;
  227.  
  228. #if defined(powerc) || defined (__powerc)
  229. #pragma options align=reset
  230. #else
  231. #if !defined(THINK_C)
  232. #pragma options align=reset
  233. #endif
  234. #endif
  235. #endif